

import commonjs from '@rollup/plugin-commonjs';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import json from '@rollup/plugin-json';
import { name, version, author } from './package.json';

const banner =
    `${'/*!\n' + ' * '}${name} v${version}\n` +
    ` * (c) ${new Date()} ${author}\n` +
    ` * Released under the ISC License.\n` +
    ` */`;

export default [
    {
      input: 'index.js',
      output: [
        {
          file: `lib/${name}.js`,
          format: 'cjs',
          name,
          banner
        },
        {
          file: `lib/${name}.min.js`,
          format: 'cjs',
          banner,
          plugins: [terser()]
        },
        {
          file: `lib/${name}.esm.js`,
          format: 'esm',
          banner
        }
      ],
      plugins: [
        nodeResolve(),
        commonjs(),
        json(),
      ]
    },
  ];